<?php

/**
 * Generated Model class.
 */
class Base_PostPeer extends Db_Peer implements ISingleton
{

    const ID = '`post`.`id`';

    const TYPE = '`post`.`type`';

    const SOURCE_ID = '`post`.`source_id`';

    const EXTERNAL_ID = '`post`.`external_id`';

    const EXTERNAL_URL = '`post`.`external_url`';

    const EXTERNAL_RATING = '`post`.`external_rating`';

    const EXTERNAL_VOTES = '`post`.`external_votes`';

    const INTERNAL_RATING = '`post`.`internal_rating`';

    const TITLE = '`post`.`title`';

    const DESCRIPTION = '`post`.`description`';

    const TEXT = '`post`.`text`';

    const TAG = '`post`.`tag`';

    const IMAGE_URL = '`post`.`image_url`';

    const IMAGE_VK_ID = '`post`.`image_vk_id`';

    const WALL_URL = '`post`.`wall_url`';

    const EXTERNAL_CREATED_AT = '`post`.`external_created_at`';

    const CREATED_AT = '`post`.`created_at`';

    const MODIFIED_AT = '`post`.`modified_at`';

    const REPOSTED_AT = '`post`.`reposted_at`';

    const DELETED_AT = '`post`.`deleted_at`';

    const IS_REPOSTED = '`post`.`is_reposted`';

    const IS_DELETED = '`post`.`is_deleted`';

    const VIEW_COUNT = '`post`.`view_count`';

    const USER_ID = '`post`.`user_id`';

    const VK_LIKES_COUNT = '`post`.`vk_likes_count`';

    const VK_REPOST_COUNT = '`post`.`vk_repost_count`';

    protected $_name = 'post';

    protected $_rowClass = 'PostRow';

    protected $_dependentTables = array('TurnPostPeer');

    protected $_referenceMap = array('SourceSourceId' => array(
            'columns' => 'source_id',
            'refTableClass' => 'SourcePeer',
            'refColumns' => 'id'
            ));

    private static $_instance = null;

    protected $_metadata = array(
        'id' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'post',
            'COLUMN_NAME' => 'id',
            'COLUMN_POSITION' => 1,
            'DATA_TYPE' => 'int',
            'DEFAULT' => null,
            'NULLABLE' => false,
            'LENGTH' => null,
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => true,
            'PRIMARY_POSITION' => 1,
            'IDENTITY' => true
            ),
        'type' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'post',
            'COLUMN_NAME' => 'type',
            'COLUMN_POSITION' => 2,
            'DATA_TYPE' => 'enum(\'text\',\'image\')',
            'DEFAULT' => 'text',
            'NULLABLE' => false,
            'LENGTH' => null,
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'source_id' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'post',
            'COLUMN_NAME' => 'source_id',
            'COLUMN_POSITION' => 3,
            'DATA_TYPE' => 'int',
            'DEFAULT' => null,
            'NULLABLE' => false,
            'LENGTH' => null,
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'external_id' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'post',
            'COLUMN_NAME' => 'external_id',
            'COLUMN_POSITION' => 4,
            'DATA_TYPE' => 'varchar',
            'DEFAULT' => null,
            'NULLABLE' => false,
            'LENGTH' => '16',
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'external_url' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'post',
            'COLUMN_NAME' => 'external_url',
            'COLUMN_POSITION' => 5,
            'DATA_TYPE' => 'varchar',
            'DEFAULT' => null,
            'NULLABLE' => true,
            'LENGTH' => '256',
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'external_rating' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'post',
            'COLUMN_NAME' => 'external_rating',
            'COLUMN_POSITION' => 6,
            'DATA_TYPE' => 'varchar',
            'DEFAULT' => null,
            'NULLABLE' => false,
            'LENGTH' => '16',
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'external_votes' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'post',
            'COLUMN_NAME' => 'external_votes',
            'COLUMN_POSITION' => 7,
            'DATA_TYPE' => 'varchar',
            'DEFAULT' => null,
            'NULLABLE' => false,
            'LENGTH' => '16',
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'internal_rating' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'post',
            'COLUMN_NAME' => 'internal_rating',
            'COLUMN_POSITION' => 8,
            'DATA_TYPE' => 'varchar',
            'DEFAULT' => null,
            'NULLABLE' => false,
            'LENGTH' => '16',
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'title' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'post',
            'COLUMN_NAME' => 'title',
            'COLUMN_POSITION' => 9,
            'DATA_TYPE' => 'varchar',
            'DEFAULT' => null,
            'NULLABLE' => true,
            'LENGTH' => '256',
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'description' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'post',
            'COLUMN_NAME' => 'description',
            'COLUMN_POSITION' => 10,
            'DATA_TYPE' => 'varchar',
            'DEFAULT' => null,
            'NULLABLE' => true,
            'LENGTH' => '256',
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'text' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'post',
            'COLUMN_NAME' => 'text',
            'COLUMN_POSITION' => 11,
            'DATA_TYPE' => 'varchar',
            'DEFAULT' => null,
            'NULLABLE' => true,
            'LENGTH' => '256',
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'tag' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'post',
            'COLUMN_NAME' => 'tag',
            'COLUMN_POSITION' => 12,
            'DATA_TYPE' => 'text',
            'DEFAULT' => null,
            'NULLABLE' => false,
            'LENGTH' => null,
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'image_url' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'post',
            'COLUMN_NAME' => 'image_url',
            'COLUMN_POSITION' => 13,
            'DATA_TYPE' => 'varchar',
            'DEFAULT' => null,
            'NULLABLE' => true,
            'LENGTH' => '256',
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'image_vk_id' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'post',
            'COLUMN_NAME' => 'image_vk_id',
            'COLUMN_POSITION' => 14,
            'DATA_TYPE' => 'varchar',
            'DEFAULT' => null,
            'NULLABLE' => true,
            'LENGTH' => '256',
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'wall_url' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'post',
            'COLUMN_NAME' => 'wall_url',
            'COLUMN_POSITION' => 15,
            'DATA_TYPE' => 'varchar',
            'DEFAULT' => null,
            'NULLABLE' => true,
            'LENGTH' => '256',
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'external_created_at' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'post',
            'COLUMN_NAME' => 'external_created_at',
            'COLUMN_POSITION' => 16,
            'DATA_TYPE' => 'datetime',
            'DEFAULT' => null,
            'NULLABLE' => true,
            'LENGTH' => null,
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'created_at' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'post',
            'COLUMN_NAME' => 'created_at',
            'COLUMN_POSITION' => 17,
            'DATA_TYPE' => 'datetime',
            'DEFAULT' => null,
            'NULLABLE' => false,
            'LENGTH' => null,
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'modified_at' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'post',
            'COLUMN_NAME' => 'modified_at',
            'COLUMN_POSITION' => 18,
            'DATA_TYPE' => 'timestamp',
            'DEFAULT' => '0000-00-00 00:00:00',
            'NULLABLE' => false,
            'LENGTH' => null,
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'reposted_at' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'post',
            'COLUMN_NAME' => 'reposted_at',
            'COLUMN_POSITION' => 19,
            'DATA_TYPE' => 'datetime',
            'DEFAULT' => null,
            'NULLABLE' => true,
            'LENGTH' => null,
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'deleted_at' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'post',
            'COLUMN_NAME' => 'deleted_at',
            'COLUMN_POSITION' => 20,
            'DATA_TYPE' => 'datetime',
            'DEFAULT' => null,
            'NULLABLE' => true,
            'LENGTH' => null,
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'is_reposted' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'post',
            'COLUMN_NAME' => 'is_reposted',
            'COLUMN_POSITION' => 21,
            'DATA_TYPE' => 'tinyint',
            'DEFAULT' => '0',
            'NULLABLE' => false,
            'LENGTH' => null,
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'is_deleted' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'post',
            'COLUMN_NAME' => 'is_deleted',
            'COLUMN_POSITION' => 22,
            'DATA_TYPE' => 'tinyint',
            'DEFAULT' => '0',
            'NULLABLE' => false,
            'LENGTH' => null,
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'view_count' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'post',
            'COLUMN_NAME' => 'view_count',
            'COLUMN_POSITION' => 23,
            'DATA_TYPE' => 'mediumint',
            'DEFAULT' => '0',
            'NULLABLE' => false,
            'LENGTH' => null,
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'user_id' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'post',
            'COLUMN_NAME' => 'user_id',
            'COLUMN_POSITION' => 24,
            'DATA_TYPE' => 'int',
            'DEFAULT' => null,
            'NULLABLE' => true,
            'LENGTH' => null,
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'vk_likes_count' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'post',
            'COLUMN_NAME' => 'vk_likes_count',
            'COLUMN_POSITION' => 25,
            'DATA_TYPE' => 'int',
            'DEFAULT' => null,
            'NULLABLE' => true,
            'LENGTH' => null,
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'vk_repost_count' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'post',
            'COLUMN_NAME' => 'vk_repost_count',
            'COLUMN_POSITION' => 26,
            'DATA_TYPE' => 'int',
            'DEFAULT' => null,
            'NULLABLE' => true,
            'LENGTH' => null,
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            )
        );

    /**
     * @return PostPeer
     */
    public static function getInstance()
    {
        if (!self::$_instance) {
        	self::$_instance = new PostPeer();
        }
        return self::$_instance;
    }

    /**
     * @return Db_Rowset
     */
    public function findById($id)
    {
        $select = $this->select();
        $select->where('`id` = ?', $id);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByType($type)
    {
        $select = $this->select();
        $select->where('`type` = ?', $type);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findBySourceId($source_id)
    {
        $select = $this->select();
        $select->where('`source_id` = ?', $source_id);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByExternalId($external_id)
    {
        $select = $this->select();
        $select->where('`external_id` = ?', $external_id);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByExternalUrl($external_url)
    {
        $select = $this->select();
        $select->where('`external_url` = ?', $external_url);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByExternalRating($external_rating)
    {
        $select = $this->select();
        $select->where('`external_rating` = ?', $external_rating);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByExternalVotes($external_votes)
    {
        $select = $this->select();
        $select->where('`external_votes` = ?', $external_votes);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByInternalRating($internal_rating)
    {
        $select = $this->select();
        $select->where('`internal_rating` = ?', $internal_rating);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByTitle($title)
    {
        $select = $this->select();
        $select->where('`title` = ?', $title);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByDescription($description)
    {
        $select = $this->select();
        $select->where('`description` = ?', $description);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByText($text)
    {
        $select = $this->select();
        $select->where('`text` = ?', $text);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByTag($tag)
    {
        $select = $this->select();
        $select->where('`tag` = ?', $tag);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByImageUrl($image_url)
    {
        $select = $this->select();
        $select->where('`image_url` = ?', $image_url);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByImageVkId($image_vk_id)
    {
        $select = $this->select();
        $select->where('`image_vk_id` = ?', $image_vk_id);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByWallUrl($wall_url)
    {
        $select = $this->select();
        $select->where('`wall_url` = ?', $wall_url);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByExternalCreatedAt($external_created_at)
    {
        $select = $this->select();
        $select->where('`external_created_at` = ?', $external_created_at);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByCreatedAt($created_at)
    {
        $select = $this->select();
        $select->where('`created_at` = ?', $created_at);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByModifiedAt($modified_at)
    {
        $select = $this->select();
        $select->where('`modified_at` = ?', $modified_at);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByRepostedAt($reposted_at)
    {
        $select = $this->select();
        $select->where('`reposted_at` = ?', $reposted_at);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByDeletedAt($deleted_at)
    {
        $select = $this->select();
        $select->where('`deleted_at` = ?', $deleted_at);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByIsReposted($is_reposted)
    {
        $select = $this->select();
        $select->where('`is_reposted` = ?', $is_reposted);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByIsDeleted($is_deleted)
    {
        $select = $this->select();
        $select->where('`is_deleted` = ?', $is_deleted);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByViewCount($view_count)
    {
        $select = $this->select();
        $select->where('`view_count` = ?', $view_count);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByUserId($user_id)
    {
        $select = $this->select();
        $select->where('`user_id` = ?', $user_id);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByVkLikesCount($vk_likes_count)
    {
        $select = $this->select();
        $select->where('`vk_likes_count` = ?', $vk_likes_count);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByVkRepostCount($vk_repost_count)
    {
        $select = $this->select();
        $select->where('`vk_repost_count` = ?', $vk_repost_count);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }


}

